﻿using SqlSugar;

namespace CleanLite.Domain.Entities
{
    public class BaseEntity
    {
        /// <summary>
        /// 主键ID（雪花ID或自定义ID）
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnDescription = "主键ID")]
        public long Id { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnDescription = "创建时间", DefaultValue = "getdate()")]
        public DateTime CreatedTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(ColumnDescription = "创建人")]
        public string CreatedBy { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>
        [SugarColumn(ColumnDescription = "最后修改时间", IsNullable = true)]
        public DateTime? UpdatedTime { get; set; }

        /// <summary>
        /// 最后修改人
        /// </summary>
        [SugarColumn(ColumnDescription = "最后修改人", IsNullable = true)]
        public string UpdatedBy { get; set; }

        /// <summary>
        /// 是否删除（逻辑删除）
        /// </summary>
        [SugarColumn(ColumnDescription = "是否删除", DefaultValue = "0")]
        public bool IsDeleted { get; set; } = false;
    }
}